<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%--
  Created by IntelliJ IDEA.
  User: Mr_Liu
  Date: 2022/2/22
  Time: 13:15
  To change this template use File | Settings | File Templates.
--%>
        <%@ page contentType="text/html;charset=UTF-8" language="java" %>
            <%@ page import="com.Liuhang.Dao.getUserList" %>
                <%@ page import="java.util.List" %>
                    <%@ taglib prefix="C" uri="http://java.sun.com/jsp/jstl/core" %>
                        <html>

                        <head>
                            <title>Title</title>
                            <link rel="stylesheet" href="css/reset.css">
                            <link rel="stylesheet" href="css/EmpManage.css">
                        </head>


                        <body>
                            <% List list = getUserList.getList();
                                  request.setAttribute("list",list);%>
                                <section class="header">
                                    <h1>员工管理系统</h1>
                                    <div>
                                        添加用户
                                    </div>

                                    <form action="emp_Search" method="get" class="add">
                                        用户ID: <input type="text" placeholder="用户ID" name="ID">
                                        <button type="submit">搜索</button>
                                    </form>
                                </section>

                                <section class="data">
                                    <table class="dataTable">
                                        <thead>
                                            <tr>
                                                <td>ID</td>
                                                <td>姓名</td>
                                                <td>性别</td>
                                                <td>部门</td>
                                                <td>电话</td>
                                                <td>薪资</td>
                                                <td>操作</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <c:forEach var="u" items="${list}" begin="0" end="9">
                                                <tr>
                                                    <td>
                                                        <C:out value="${u.getId()}" />
                                                    </td>
                                                    <td>
                                                        <C:out value="${u.getName()}" />
                                                    </td>
                                                    <td>
                                                        <C:out value="${u.getSex()}" />
                                                    </td>
                                                    <td>
                                                        <C:out value="${u.getDep_name()}" />
                                                    </td>
                                                    <td>
                                                        <C:out value="${u.getPhone()}" />
                                                    </td>
                                                    <td>
                                                        <C:out value="${u.getMoney()}" />
                                                    </td>
                                                    <td>
                                                        <a href="emp_update?id=${u.getId()}&name=${u.getName()}&sex=${u.getSex()}&phone=${u.getPhone()}&money=${u.getMoney()}&passwd=${u.getPasswd()}">修改</a>
                                                        <a href="user_del?id=${u.getId()}">删除</a>
                                                    </td>
                                                </tr>
                                            </c:forEach>
                                        </tbody>
                                    </table>
                                </section>
                        </body>

                        </html>